Methods
(static) roundTo(precision) → {function}
- Source:
- Since:
- 0.6.0
- See:
Return a function that rounds the input number to the provided number of digits.
Example
> roundTo2 = roundTo(2)
> roundTo2(2.41285)
2.41
> roundTo2(2.41785)
2.42
Parameters:
Name | Type | Description |
---|---|---|
precision |
number | Must be an integer |
Returns:
- Number -> Number
- Type
- function